<template>
  <h2>我是About的内容</h2>
</template>

<script>
export default {
  name: "About",
  beforeDestroy() {
    console.log("About即将销毁");
  },
  mounted() {
    console.log("About挂载完毕", this);
    console.log(this.$route);
    window.aboutRoute = this.$route;
    window.aboutRouter = this.$router;
  },
  // 通过路由规则进入该组件时调用
  beforeRouteEnter(to, from, next) {
    console.log("App___beforeRouteEnter");
    if (to.meta.isAuth) {
      if (localStorage.getItem("name") === "song") {
        next();
      } else {
        alert("用户名不对无权查看");
      }
    } else {
      next();
    }
  },
  // 通过路由规则离开该组件时调用
  beforeRouteLeave(to, from, next) {
    console.log("App___beforeRouteLeave");
    next()
  },
};
</script>

<style>
</style>